#include "floatimage.H"

floatimage InputImage;
floatimage FlowImage;
floatimage OutputImage;

void main(int argc, char *argv[])
{
	InputImage.LoadPFM("source.pfm");
	FlowImage.LoadPFM("flow.pfm");

	OutputImage.Allocate(InputImage.sizex,InputImage.sizey);

	vec2f t;

	for (int j=0;j<OutputImage.sizey;j++)
	{
		for (int i=0;i<OutputImage.sizex;i++)
		{
			t.x = FlowImage.line(j)[i].r + (float)i + 0.5;
			t.y = FlowImage.line(j)[i].g + (float)j + 0.5;
			OutputImage.line(j)[i] = InputImage.GetPixelBilinear(t.x, t.y);
		}
	}

	OutputImage.SavePFM("check.pfm");

}